import React from 'react';
import {withRouter} from 'react-router-dom';
import {GoPagePush,LocalParam} from '../../assets/js/utils/index';

import Css from './index.css';
class orderComponent extends React.Component{
    constructor(props){
        super(props);
        this.state={
            status:LocalParam(props.location.search).search.status?LocalParam(props.location.search).search.status:''
        }
    }
    UNSAFE_componentWillReceiveProps(newProps){
        this.setState({status:LocalParam(newProps.location.search).search.status})
    }
    goPage(url){
        GoPagePush(this.props,'transfer/index');
        setTimeout(()=>{
            GoPagePush(this.props,url)
        },10)
    }
    componentWillUnmount(){
        this.setState = (state, callback) => {
            return;
        };
    }
    render(){
        return(
            <div className={Css['main']}>
                <div className={this.state.status==='all'?Css['group']+' '+Css['active']:Css['group']} onClick={this.goPage.bind(this,'order/order?status=all')}>全部订单</div>
                <div className={this.state.status==='0'?Css['group']+' '+Css['active']:Css['group']} onClick={this.goPage.bind(this,'order/order?status=0')}>待付款</div>
                <div className={this.state.status==='1'?Css['group']+' '+Css['active']:Css['group']} onClick={this.goPage.bind(this,'order/order?status=1')}>待收货</div>
                <div className={this.state.status==='2'?Css['group']+' '+Css['active']:Css['group']} onClick={this.goPage.bind(this,'order/review?status=2')}>待评价</div>
            </div>
        )
    }
}
export default withRouter(orderComponent);